//
//  WBPictureView.swift
//  XLWibo-Swift
//
//  Created by 王林 on 2016/11/17.
//  Copyright © 2016年 木木. All rights reserved.
//

import UIKit
let ID = "CELL"
class WBPictureView: UICollectionView ,UICollectionViewDataSource{

    var pictureInfoS:[WBPictureInfo]?{
        didSet{
            self.reloadData()
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        let cellNib = UINib(nibName:"WBCollectionViewCell", bundle: nil)
        self.register(cellNib, forCellWithReuseIdentifier:ID)
        self.dataSource = self
    }
    
    
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return pictureInfoS?.count ?? 0
        
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! WBCollectionViewCell
        let pic = pictureInfoS?[indexPath.row]
        cell.picInfo = pic
        return cell
    }
    

}

